<?php


namespace Trawind\Remotes\Repositories\Account\Config;


use Trawind\Basics\Enums\ServiceDomain;
use Trawind\Remotes\BaseRepository;
use Trawind\Remotes\Contracts\Repositories\Account\Config\UserRepository;

class UserRepositoryEloquent extends BaseRepository implements UserRepository
{

    public $baseRoute='/config/users';

    
    /**
     * UserRepositoryEloquent constructor.
     */
    public function __construct()
    {
        $this->domain = ServiceDomain::ACCOUNT_DOMAIN();
    }


    public function getData()
    {
        // TODO: Implement getData() method.
    }

    public function getUserConfig(?string $key = null)
    {
        $url = is_null($key) ? $this->baseRoute : $this->baseRoute ."?key=$key";
        return static::getResponseData($this->setUrl($this->baseRoute)->client('user')->get($url, $this->clientOptions));
    }


    public function saveConfig(array $configs)
    {
        return $this->setUrl($this->baseRoute)
            ->setClientOptions(['form_params' => ['data' => $configs]])
            ->result('POST');
    }

    public function getLanguage()
    {
        return $this->setUrl('/config/user-language')->result();
    }

    public function all($columns = ['*'])
    {
        // TODO: Implement all() method.
    }

    public function find($id, $columns = ['*'])
    {
        // TODO: Implement find() method.
    }

    public function create(array $attributes)
    {
        // TODO: Implement create() method.
    }

    public function update(array $attributes, $id)
    {
        // TODO: Implement update() method.
    }
}
